   1 import wx
   2 
   3 
   4 # Some classes to use for the notebook pages.  Obviously you would
   5 # want to use something more meaningful for your application, these
   6 # are just for illustration.
   7 
   8 class PageOne(wx.Panel):
   9     def __init__(self, parent):
  10         wx.Panel.__init__(self, parent)
  11         t = wx.StaticText(self, -1, "This is a PageOne object", (20,20))
  12 
  13 class PageTwo(wx.Panel):
  14     def __init__(self, parent):
  15         wx.Panel.__init__(self, parent)
  16         t = wx.StaticText(self, -1, "This is a PageTwo object", (40,40))
  17 
  18 class PageThree(wx.Panel):
  19     def __init__(self, parent):
  20         wx.Panel.__init__(self, parent)
  21         t = wx.StaticText(self, -1, "This is a PageThree object", (60,60))
  22 
  23 
  24 class MainFrame(wx.Frame):
  25     def __init__(self):
  26         wx.Frame.__init__(self, None, title="Simple Notebook Example")
  27 
  28         # Here we create a panel and a notebook on the panel
  29         p = wx.Panel(self)
  30         nb = wx.Notebook(p)
  31 
  32         # create the page windows as children of the notebook
  33         page1 = PageOne(nb)
  34         page2 = PageTwo(nb)
  35         page3 = PageThree(nb)
  36 
  37         # add the pages to the notebook with the label to show on the tab
  38         nb.AddPage(page1, "Page 1")
  39         nb.AddPage(page2, "Page 2")
  40         nb.AddPage(page3, "Page 3")
  41 
  42         # finally, put the notebook in a sizer for the panel to manage
  43         # the layout
  44         sizer = wx.BoxSizer()
  45         sizer.Add(nb, 1, wx.EXPAND)
  46         p.SetSizer(sizer)
  47 
  48 
  49 if __name__ == "__main__":
  50     app = wx.App()
  51     MainFrame().Show()
  52     app.MainLoop()
